<template>
	<view class="block-menu">
		<view class="menu" v-for="(item,index) in data" :key="index" :style="{width:width+'%'}"
			@click="goPage(item.cate_name,item.id)">
			<image :src=" item.img" mode=""></image>
			<text>{{item.cate_name}}</text>
		</view>
	</view>
</template>

<script>
	import {mapState} from "vuex";
	export default {
		name: "BlockMenu",
		props: {
			data: {
				type: [Array],
				default () {
					return []
				}
			},
			width: {
				type: Number,
				default: 20
			}
		},
		data() {
			return {

			}
		},
		computed:{
			...mapState(["userInfo"]),
		},
		methods: {
			goPage(name,id) {
				if(this.userInfo.reward_lord){
					uni.navigateTo({
						url: "/pages/mutual/release-next/release-next"+"?titleTabar="+name+"&id="+id
					})
				}else{
					uni.navigateTo({
						url: "/pages/public/not-open-reward/not-open-reward"
					})
				}
			}
		}
	}
</script>

<style scoped lang="less" src="./BlockMenu.less"></style>
